package cn.jzq.spring.springioc.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jzq
 * @date 2019/3/20 14:25
 */
@RestController
@RequestMapping("/app")
public class App {

    private final UserService userService;

    public App() {
        UserMapper userMapper = new UserMapper();
        this.userService = new UserServiceImpl(userMapper);
    }

    @GetMapping("/{id}")
    public User getUser(@PathVariable("id")Integer id) {
        return userService.getUserById(id);
    }

}
